<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>

<link rel="stylesheet" href="/css/certificateWeb/onLineApply/onLineApply.css">
<body id="body" style="background: #F8F9FB">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main" style="background: #fff">
    <div class="div_3" style="position: relative;margin:80px auto 60px auto;width: 1130px;">
        <img style="width: 1100px" src="/img/step4.png"/>
        <span class="step1 this1">申报条件</span>
        <span class="step2 this1">填报信息</span>
        <span class="step3 this1">信息审核</span>
        <span class="step4 this1">在线缴费</span>
        <span class="step5">报名成功</span>
    </div>
    <section id="pay">
        <div class="flex">
            <div>
                <img class="wd140" src="/img/WePayLogo.png" />
                <span>| 收银台</span>
            </div>
            <div class="mid">
                <div >订单将在2个小时后关闭，请及时支付</div>
                <div class="mar20">
                    <img class="wd200" id="img" src="" />
                </div>
                <div>请使用微信扫一扫完成支付</div>
            </div>
        </div>
        <div class="flex_1">
            <div style="margin-left: 60px">
                <div class="title">报名订单</div>
                <div class="price_1">¥<span class="price" th:text="${examFee}"></span></div>
                <div class="mar10">
                    <span class="gray">收款方</span>
                    <span class="black">湖南金职伟业母婴护理有限公司</span>
                </div>
                <!--<div class="mar10">-->
                    <!--<span class="orderTime">下单时间</span>-->
                    <!--<span class="black">2020-03-12 11:00:29</span>-->
                <!--</div>-->
                <div class="mar10">
                    <span class="gray">订单号</span>
                    <span class="black" th:text="${signId}"></span>
                </div>
            </div>
        </div>
        <input type="hidden" th:value="${chatchId}" name="chatchId" id="chatchId"/>
        <input type="hidden" th:value="${signId}" id="signId"/>
        <input type="hidden" th:value="${examFee}" id="examFee"/>
    </section>
</main>
<div th:include="certificateWeb/headFoot :: footer"></div>
<script>
    wxPay();
    function wxPay () {
        ajaxToken("/userInfo/wxPay", "POST", {
          body:'报名费用',
                trade_type:'NATIVE',
                stuSignUpId: $("#signId").val()
        }, function (res) {
            $("#img").attr("src", res.wx.data.code_url)
        });
    }
    monitor();
    var timer = null;
    function monitor() {
        timer=window.setInterval(queryWxPay,3000)
    }
    function queryWxPay() {
        $.ajax({
            url: "/userInfo/selSignUpState",
            data:{
                stuSignUpId: $("#signId").val()
            },
            success: function (data) {
                if(data.data==4){
                    window.clearInterval(timer);
                    $("#img").attr("src",'/img/wxsuccess.png');
                    location.href = '/certificate/applySuccess?signId=' +$("#signId").val()+'&chatchId='+$("#chatchId").val()
                }
                console.log("data",data);
            }
        });
    }

</script>
</body>
</html>